<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <title>骨医快线</title>
    <link href="../../css/mui.plus.css" rel="stylesheet"/>
    <style>
    	.mui-table-view-cell > a:not(.mui-btn) {
    		white-space: normal;
    	}
    	.pat-new-comm {
		    margin-left: 10px;
			padding: 5px;
			font-size: 12px;
			background-color: #f5f5f5;
			color: #30b497;
    	}
    	#cmt-list div {
    		font-size: 14px;
    		color: #8f8f94;
    	}
    	#cmt-list p {
    		font-size: 17px;
    		color: #000;
    	}
    	#cmt-list img {
    		border-radius: 50px;
    	}
    </style>
</head>
<body>
	<header class="mui-bar mui-bar-nav oe-pri-bar">
	    <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
	    <h1 class="mui-title">所有评论</h1>
	</header>
	
	<div class="mui-content">
		
		<div id="title-news" class="oe-article" style="margin-top: 10px;">
			<p class="oe-title-art">冻出来的关节炎系误读</p>
			<p class="oe-title-artsub" style="margin-top: 5px;">骨医快线&nbsp;&nbsp;&nbsp;2016.2.5</p>
		</div>
		
		<script id="tmp-news" type="text/html">
			{{if news}}
				<p class="oe-title-art">{{news.news_title}}</p>
				<p class="oe-title-artsub" style="margin-top: 5px;">骨医快线&nbsp;&nbsp;&nbsp;{{news.news_post_time}}</p>
			{{/if}}
		</script>
		
		<div>
			<span class="pat-new-comm">最新评论</span>
		</div>
		
		<div class="oe-divide-block"></div>
		
		<ul id="cmt-list" class="mui-table-view">
			<!--<li class="mui-table-view-cell mui-media">
				<a href="javascript:;">
					<img class="mui-media-object mui-pull-left" src="../../images/dr_avatar.png">
					<div class="mui-media-body">
						幸福
						<p>能和心爱的人一起睡觉，是件幸福的事情；可是，打呼噜怎么办？</p>
					</div>
				</a>
			</li>-->
		</ul>
		
	</div>
	
	<script id="tmp-cmt-list" type="text/html">
		{{each data as v i}}
			<li class="mui-table-view-cell mui-media">
				<a href="javascript:;">
					<img class="mui-media-object mui-pull-left" src="{{v.dr_avatar_src}}">
					<div class="mui-media-body">
						<div style="margin-bottom: 5px;">{{v.dr_name}}</div>
						<p>{{v.ncom_text}}</p>
					</div>
				</a>
			</li>
		{{/each}}		
	</script>
    <script src="../../js/mui.min.js"></script>
    <script src="../../js/app.js"></script>
	<script src="../../js/lib/template.js"></script>    
    <script type="text/javascript">
		(function($){
			var      id = {},
				tmpData = {},
				cmtList = document.getElementById("cmt-list"),
				wv;
				
			var getCommontList = function(id){
				app.net.get('news_comms/show_list.json', {news_id: id}, function(data){
					if(data && data.code === '100'){
						tmpData  = data;
						var html = template('tmp-cmt-list', tmpData);
						cmtList.innerHTML = html;  
					}
				});
			}
			
			var getNewsInfo = function(id){
				app.net.get('news/show.json', {news_id: id, dr_id: app.storage.getUserId()}, function(data){
					if(data && data.code === '100'){
						tmpData.news  = data.data;
						var html = template('tmp-news', tmpData);
						document.getElementById("title-news").innerHTML = html;  
					}
				});
			}
			
			$.plusReady(function(){
				wv        = plus.webview.currentWebview();
				id.newsId = wv.newsId;
				
				getNewsInfo(id.newsId);
				getCommontList(id.newsId);
			});
			
		}(mui));
    </script>
</body>
</html>